<template>
  <div style='margin-right:50px'>
    <el-form
      :model='ruleForm'
      status-icon
      :rules='rules'
      ref='ruleForm'
      label-width='140px'
      class='demo-ruleForm'
      style='margin-top: 50px'
      size='mini'>
      <el-row>
        <el-col :span='8'>
          <el-form-item label='产品组合:' prop='age'>
            <el-select
              v-model='ruleForm.t8_sys_portfol_id'
              class='venus-input-middle'
              placeholder='--请选择产品组合--'
            >
              <el-option
                v-for='(item) in dict.t8_sys_portfol_id'
                :key='item.value'
                :label='item.text'
                :value='item.value'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='产品/SPV:' prop='age'>
            <el-select
              v-model='ruleForm.t8_prod_info_id'
              class='venus-input-middle'
              placeholder='--请选择产品/SPV--'
            >
              <el-option
                v-for='(item) in dict.t8_prod_info_id'
                :key='item'
                :label='item'
                :value='item'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='产品/SPV余额(元):' prop='age'>
            <el-input v-model='ruleForm.prod_principalbln'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易日期:' prop='age'>
            <el-date-picker
              v-model='ruleForm.tradedate'
              type='date'
              class='venus-input-middle venus-input-date'
              placeholder='请选择交易日期'
              value-format='yyyyMMdd'
            />
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易对手:' prop='age'>
            <el-select
              v-model='ruleForm.t8_oside_basei_id'
              class='venus-input-middle'
              placeholder='--请选择交易对手--'
            >
              <el-option
                v-for='(item) in dict.t8_oside_basei_id'
                :key='item.value'
                :label='item.text'
                :value='item.value'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易方向:' prop='age'>
            <el-select
              v-model='ruleForm.direction'
              class='venus-input-middle'
              placeholder='--请选择交易方向--'
            >
              <el-option
                v-for='(text,key) in dict.direction'
                :key='key'
                :label='text'
                :value='key'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='清算速度:' prop='age'>
            <el-select
              v-model='ruleForm.direction'
              class='venus-input-middle'
              placeholder='--请选择清算速度--'
            >
              <el-option
                v-for='(text,key) in dict.valuedays'
                :key='key'
                :label='text'
                :value='key'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='取消联动:' prop='age'>
            <el-checkbox v-model='ruleForm.pd' true-label='1' false-label='0'></el-checkbox>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='市场:' prop='age'>
            <el-select
              v-model='ruleForm.marketplaceid'
              class='venus-input-middle'
              placeholder='--请选择市场--'
            >
              <el-option
                v-for='(text,key) in dict.marketplaceid'
                :key='key'
                :label='text'
                :value='key'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='债券信息:' prop='age'>
            <el-select
              v-model='ruleForm.bond_id'
              class='venus-input-middle'
              placeholder='--请选择债券信息--'
            >
              <el-option
                v-for='(item) in dict.bond_id'
                :key='item.value'
                :label='item.text'
                :value='item.value'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='债券名称:' prop='age'>
            <el-input v-model='ruleForm.bond_name'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='净价(元):' prop='age'>
            <el-input v-model='ruleForm.net_price'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='劵面总额(万元):' prop='age'>
            <el-input v-model='ruleForm.all_money'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='到期收益率(%):' prop='age'>
            <el-input v-model='ruleForm.end_ytm'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='行权收益率(%):' prop='age'>
            <el-input v-model='ruleForm.exercise_ytm'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易金额(元):' prop='age'>
            <el-input v-model='ruleForm.money'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='应计利息(元):' prop='age'>
            <el-input v-model='ruleForm.interest'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='应计利息总额(元):' prop='age'>
            <el-input v-model='ruleForm.all_ai'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='全价(元):' prop='age'>
            <el-input v-model='ruleForm.full_price'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='结算金额(元):' prop='age'>
            <el-input v-model='ruleForm.settle_money'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='结算方式:' prop='age'>
            <el-select
              v-model='ruleForm.settleterm'
              class='venus-input-middle'
              placeholder='--请选择结算方式--'
            >
              <el-option
                v-for='(text,key) in dict.settleterm'
                :key='key'
                :label='text'
                :value='key'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='结算日期:' prop='age'>
            <el-date-picker
              v-model='ruleForm.settle_date'
              type='date'
              class='venus-input-middle venus-input-date'
              placeholder='请选择结算日期'
              value-format='yyyyMMdd'
            />
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='剩余年限(年):' prop='age'>
            <el-input v-model='ruleForm.remainder'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='中债净价(元):' prop='age'>
            <el-input v-model='ruleForm.mid_netprice'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='偏离程度(%):' prop='age'>
            <el-input v-model='ruleForm.eccentricity'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='会计分类:' prop='age'>
            <el-select
              v-model='ruleForm.account_type'
              class='venus-input-middle'
              placeholder='--请选择会计分类--'
            >
              <el-option
                v-for='(text,key) in dict.account_type'
                :key='key'
                :label='text'
                :value='key'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='持有份额(份):' prop='age'>
            <el-input v-model='ruleForm.hfaceamount'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易中心手续费(元):' prop='age'>
            <el-input v-model='ruleForm.service_charge'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='交易中心过户费(元):' prop='age'>
            <el-input v-model='ruleForm.settlement_fee'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='备注:' prop='age'>
            <el-input v-model='ruleForm.note'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='资金账号:' prop='age'>
            <el-select
              v-model='ruleForm.account_code'
              class='venus-input-middle'
              placeholder='--请选择资金账号--'
            >
              <el-option
                v-for='(item) in dict.account_code'
                :key='item.value'
                :label='item.text'
                :value='item.value'
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='资金账户名称:' prop='age'>
            <el-input v-model='ruleForm.account_name'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='开户行名称:' prop='age'>
            <el-input v-model='ruleForm.opening_account_name'></el-input>
          </el-form-item>
        </el-col>
        <el-col :span='8'>
          <el-form-item label='开户行行号:' prop='age'>
            <el-input v-model='ruleForm.opening_account_num'></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <div style='text-align:center'>
        <el-button type='success' @click=''>提交</el-button>
        <el-button type='info' @click=''>重置</el-button>
      </div>
    </el-form>
  </div>
</template>
<style>

</style>
<script>
  import * as kk from '@/utils/k-utils'
  import request from '@/utils/request'

  export default {
    name: 'BondDeal',
    data() {
      return {
        dict: {
          t8_sys_portfol_id: {}, // 产品组合
          t8_prod_info_id: {}, // 产品/SPV
          t8_oside_basei_id: {}, // 交易对手
          direction: {}, // 交易方向
          valuedays: {}, // 清算速度
          marketplaceid: {}, // 市场
          bond_id: {}, // 债券信息
          settleterm: {}, // 结算方式
          account_type: {}, // 会计分类
          account_code: {} // 资金账号
        },
        ruleForm: {
          t8_sys_portfol_id: '', // 产品组合
          t8_prod_info_id: '', // 产品/SPV
          prod_principalbln: '', // 产品/SPV余额(元)
          tradedate: '', // 交易日期
          t8_oside_basei_id: '', // 交易对手
          direction: '', // 交易方向
          valuedays: '', // 清算速度
          pd: '', // 取消联动
          marketplaceid: '', // 市场
          bond_id: '', // 债券信息
          bond_name: '', // 债券名称
          net_price: '', // 净价(元)
          all_money: '', // 劵面总额(万元)
          end_ytm: '', // 到期收益率(%)
          exercise_ytm: '', // 行权收益率(%)
          money: '', // 交易金额(元)
          interest: '', // 应计利息(元)
          all_ai: '', // 应计利息总额(元)
          full_price: '', // 全价(元)
          settle_money: '', // 结算金额(元)
          settleterm: '', // 结算方式
          settle_date: '', // 结算日期
          remainder: '', // 剩余年限(年)
          mid_netprice: '', // 中债净价(元)
          eccentricity: '', // 偏离程度(%)
          account_type: '', // 会计分类
          hfaceamount: '', // 持有份额(份)
          service_charge: '', // 交易中心手续费(元)
          settlement_fee: '', // 交易中心过户费(元)
          note: '', // 备注
          account_code: '', // 资金账号
          account_name: '', // 资金账户名称
          opening_account_name: '', // 开户行名称
          opening_account_num: '' // 开户行行号
        },
        rules: {}
      }
    },
    mounted() {
      // 初始化调用
      this.init()
    },
    methods: {
      init: function() {
        this.load_dict_exeid(this, 'public', 'selectPortfol', 't8_sys_portfol_id')
        this.load_dict_exeid(this, 'public', 'selectProd', 't8_prod_info_id')
        this.load_dict_exeid(this, 'public', 'selectOSIDE', 't8_oside_basei_id')
        this.load_dict_exeid(this, 'bond', 'M8222EQ0013', 'bond_id')
        this.load_dict_exeid(this, 'public', 'selectAccByCondition', 'account_code')
        kk.k_load_dict(this, 'direction', 't8_direction')
        kk.k_load_dict(this, 'valuedays', 't8_clearing_speed')
        kk.k_load_dict(this, 'marketplaceid', 't8_market_code')
        kk.k_load_dict(this, 'settleterm', 't8_pay_type')
        kk.k_load_dict(this, 'account_type', 't8_account_type')
      },
      /* 通过exeid加载字典 */
      load_dict_exeid(this_object, service_name, exeid, dict) {
        request({
          loading: true,
          url: service_name + '/base/comn-query.json?exeid=' + exeid,
          method: 'post'
        }).then(rep => {
          console.log(rep)
          this_object['dict'][dict] = rep.rows
        })
      }
    }
  }
</script>

<style scoped>
</style>
